<?php

$installer = $this;

$installer->startSetup();

$installer->run("

-- DROP TABLE IF EXISTS {$this->getTable('robot')};
CREATE TABLE {$this->getTable('robot')} (
  `robot_id` int(11) unsigned NOT NULL auto_increment,
  `type` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL default '',
  `keyword` text NOT NULL default '',
  `category` varchar(255) NOT NULL default '',
  `create_category` smallint(6) NOT NULL default '0',
  `title_template` varchar(255) NOT NULL default '',
  `content_template` text NOT NULL default '',
  `store_id` int(11) NOT NULL default '0',
  `status` smallint(6) NOT NULL default '0',
  `number_of_records` int(11) NOT NULL,
  `field` text NOT NULL default '',
  `created_time` datetime NULL,
  `update_time` datetime NULL,
  PRIMARY KEY (`robot_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


-- DROP TABLE IF EXISTS {$this->getTable('robot_posts')};
CREATE TABLE {$this->getTable('robot_posts')} (
  `id` int(11) unsigned NOT NULL auto_increment,
  `campaign_id` int(11) NOT NULL,
  `keyword` varchar(255) NOT NULL,
  `unique_id` text NOT NULL,
  `created_time` datetime NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- DROP TABLE IF EXISTS {$this->getTable('robot_errors')};
CREATE TABLE {$this->getTable('robot_errors')} (
  `id` int(11) unsigned NOT NULL auto_increment,
  `campaign_id` int(11) NOT NULL,
  `keyword` varchar(255) NOT NULL,
  `reason` varchar(255) NOT NULL,
  `message` text NOT NULL,
  `created_time` datetime NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


    ");

$installer->endSetup(); 